{% extends "admin/base_site.html" %}

{% load i18n %}
{% load admin_urls admin_static admin_modify %}
{% load breadcrumbs %}

{% block extrahead %}
{{ block.super }}
<script type="text/javascript" src="{% url 'admin:jsi18n' %}"></script>
{{ media }}
{% endblock %}

{% block extrastyle %}
{{ block.super }}
<link rel="stylesheet" type="text/css" href="{% static "admin/css/forms.css" %}" />
{% endblock %}

{% block breadcrumb-list %}
{% add_crumb 'Home' '/' %}
{% url 'admin:index' as admin_index %}
{% add_crumb 'Administration' admin_index %}
{% url 'admin:app_list' app_label=opts.app_label as app_list %}
{% add_crumb app_label|capfirst|escape app_list %}
{% if has_change_permission %}
{% add_crumb opts.verbose_name_plural|capfirst opts|admin_urlname:'changelist' %}
{% else %}
{% add_crumb opts.verbose_name_plural|capfirst %}
{% endif %}
{% add_crumb title %}
{% endblock %}

{% block object-tools %}
    {% if change %}{% if not is_popup %}
    {% if has_absolute_url %}<li class="search"><a title="{% trans 'View on site' %}" href="{% url 'admin:view_on_site' content_type_id original.pk %}">{% trans "View on site" %}</a></li>{% endif%}
    <li class="list">
        {% url opts|admin_urlname:'history' original.pk|admin_urlquote as history_url %}
        <a title="{% trans 'History' %}" href="{% add_preserved_filters history_url %}">{% trans "History" %}</a>
    </li>
    {% url opts|admin_urlname:'delete' original.pk|admin_urlquote as delete_url %}
    <li class="delete"><a title="{% trans 'Delete' %}" href="{% add_preserved_filters delete_url %}">{% trans "Delete" %}</a></li>
    {% endif %}{% endif %}
{% endblock %}

{% block content %}
<form {% if has_file_field %}enctype="multipart/form-data" {% endif %}action="{{ form_url }}" method="post" id="{{ opts.model_name }}_form">{% csrf_token %}{% block form_top %}{% endblock %}
<div>
{% if is_popup %}<input type="hidden" name="_popup" value="1" />{% endif %}
{% if save_on_top %}{% block submit_buttons_top %}{% submit_row %}{% endblock %}{% endif %}
{% if errors %}
    <p class="errornote">
    {% if errors|length == 1 %}{% trans "Please correct the error below." %}{% else %}{% trans "Please correct the errors below." %}{% endif %}
    </p>
    {{ adminform.form.non_field_errors }}
{% endif %}

{% block field_sets %}
{% for fieldset in adminform %}
{% include "admin/includes/fieldset.html" %}
{% endfor %}
{% endblock %}

{% block after_field_sets %}{% endblock %}

{% block inline_field_sets %}
{% for inline_admin_formset in inline_admin_formsets %}
{% include inline_admin_formset.opts.template %}
{% endfor %}
{% endblock %}

{% block after_related_objects %}{% endblock %}

{% block submit_buttons_bottom %}{% submit_row %}{% endblock %}

{% if adminform.first_field and add %}
<script type="text/javascript">document.getElementById("{{ adminform.first_field.id_for_label }}").focus();</script>
{% endif %}

{# JavaScript for prepopulated fields #}
{% prepopulated_fields_js %}

</div>
</form>
{% endblock %}
